<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>C:\WorkingCopy\vimcolorschemetest\trunk\samples\GetEnv.java.html</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=Big5">
<style type="text/css">
<!--
.level14c { color: #ccaa88; }
.javaString { color: #b87849; }
.javaRepeat { color: #bcba88; }
.Operator { color: #bb9988; }
.level15c { color: #bb9977; }
.javaScopeDecl { color: #854433; }
.javaClassDecl { color: #be7012; }
.javaDocComment { color: #88b899; }
.Comment { color: #689879; }
.Special { color: #bdb76b; }
.Function { color: #bd3422; font-weight: bold; }
.StorageClass { color: #cc3021; }
.Type { color: #975546; font-weight: bold; }
.level16c { color: #aa8866; }
pre { font-family: monospace; color: #953434; background-color: #180000; }
body { font-family: monospace; color: #953434; background-color: #180000; }
.Include { color: #86bb33; font-weight: bold; }
-->
</style>
</head>
<body>
<pre>
<span class="Include">import</span> java.util.Map;
<span class="Include">import</span> java.util.TreeSet;

<span class="javaScopeDecl">public</span> <span class="javaClassDecl">class</span> GetEnv {
  <span class="javaDocComment">/**</span>
<span class="Comment">   *</span><span class="Special"> let's test generics</span>
<span class="Comment">   </span><span class="javaDocComment">* </span><span class="Special">@param</span><span class="Function"> args</span><span class="javaDocComment"> the command line arguments</span>
<span class="javaDocComment">   */</span>
  <span class="javaScopeDecl">public</span> <span class="StorageClass">static</span> <span class="Type">void</span> main<span class="level16c">(</span>String[] args<span class="level16c">)</span> {
    <span class="Comment">// get a map of environment variables</span>
    Map&lt;String, String&gt; env = System.getenv<span class="level16c">()</span>;
    <span class="Comment">// build a sorted set out of the keys and iterate</span>
    <span class="javaRepeat">for</span><span class="level16c">(</span>String k: <span class="Operator">new</span> TreeSet&lt;String&gt;<span class="level15c">(</span>env.keySet<span class="level14c">()</span><span class="level15c">)</span><span class="level16c">)</span> {
      System.out.printf<span class="level16c">(</span><span class="javaString">&quot;%s = %s</span><span class="Special">\n</span><span class="javaString">&quot;</span>, k, env.get<span class="level15c">(</span>k<span class="level15c">)</span><span class="level16c">)</span>;
    }
  }
}
</pre>
</body>
</html>
